﻿using Microsoft.EntityFrameworkCore;
using PLC.Domain.Entity;

namespace PLC.Infrastructure.DbContext;

public class PlcServerDbContext:Microsoft.EntityFrameworkCore.DbContext
{
    // 调用父类的构造函数  这步是配置依赖注入的上下文
    public PlcServerDbContext(DbContextOptions<PlcServerDbContext> options):base(options)
    {
    }
    /// <summary>
    /// 条码
    /// </summary>
    public DbSet<BarcodeData> BarcodeData { get; set; }
    /// <summary>
    /// 数据配置
    /// </summary>
    public DbSet<DataConfig> DataConfig { get; set; }
    /// <summary>
    /// 设备配置
    /// </summary>
    public DbSet<DeviceConfig> DeviceConfig { get; set; }
    /// <summary>
    /// 设备状态
    /// </summary>
    public DbSet<DeviceStatus> DeviceStatus { get; set; }
    /// <summary>
    ///  装堆积压力数据
    /// </summary>
    public DbSet<PressureData> PressureData { get; set; }
    /// <summary>
    /// 气密数据
    /// </summary>
    public DbSet<AirtightData> AirtightData { get; set; }
    /// <summary>
    /// 维修工位的气密数据
    /// </summary>
    public DbSet<RepairAirtightData> RepairAirtightData { get; set; }
    /// <summary>
    /// 生产数据主表
    /// </summary>
    public DbSet<ProductionData> ProductionData { get; set; }
    /// <summary>
    /// 相机数据
    /// </summary>
    public DbSet<CCDData> CCDData { get; set; }
    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        base.OnModelCreating(modelBuilder);
        // 通过反射 获取配置
        modelBuilder.ApplyConfigurationsFromAssembly(this.GetType().Assembly);
    }
}